home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18087 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: cbisinet.cbis.com!ptutko
  2. From: ptutko@cbis.com (Peter Tutko)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Computer hangs at the end of this when run. (iostreams and fstreams)
  5. Date: 18 Apr 1996 20:02:46 GMT
  6. Organization: Cincinnati Bell Information Systems
  7. Message-ID: <4l6756$91o@cbisinet.cbis.com>
  8. References: <4l1oce$18s@majesty.lightlink.com>
  9. NNTP-Posting-Host: mongoose.isd.cbis.com
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Justin Kramer AKA Tinman (jkramer@lightlink.com) wrote:
  13. : Hi,
  14.  
  15. :     I JUST started to program in C++ with iostreams ...
  16.  
  17. [code example snipped]
  18.  
  19. Your problem is that you have not allocated space for the character strings,
  20. just a pointer to it.  Go ahead and declare a while array for the string:
  21.  
  22.     char line[80];
  23.  
  24. Then try to output it via the stream.  I think you'll find it works a bit better.
  25.  
  26.  
  27. -- 
  28. Peter M. Tutko                        "Nobody gets in to see the Wizard.
  29. ptutko@access.digex.net                Not no body. No nohow." - F.Baum
  30.                                       "You are a strange, sad little man
  31.                                        and you have my pity." - B.Lightyear
  32.